<?php

$str = $_POST['stuff'];
/*$str = "MMMMM----- Recipe via Meal-Master (tm) v8.04
 
      Title: Camp Stew
 Categories: Outdoors, Main dish, Beef, Teri
      Yield: 1 servings
 
      2 lb Hamburger
      1    Can stewed tomatoes
      1    Can corn
      8 oz Elbow macaroni
    1/2 c  Chopped onions
      1 c  Water
    1/4 lb Longhorn cheddar cheese
 
  Brown beef in dutch oven, kettle, or skillet.  Drain.  Stir in
  tomatoes, corn, macaroni, and water.
  Cook until done.  Just before serving add cheese.
  
                Girl Scouts of America
 
MMMMM";*/

echo $str;
echo "<br /><br />";

$strexp=explode("\n \n",$str);

$tit_cat_ser=$strexp[1];
$ingred=$strexp[2];
$direct=$strexp[3];

$tit_cat_ser_exp=explode("\n",$tit_cat_ser);

$title=$tit_cat_ser_exp[0];
$cat=$tit_cat_ser_exp[1];
$serv=$tit_cat_ser_exp[2];

echo str_replace("Title: ", "" , $title);
echo "<br />";
echo str_replace("Categories: ", "" , $cat);
echo "<br />";
echo str_replace("Yield: ", "" , $serv);
echo "<br /><br />";
echo nl2br($ingred);
echo "<br />";
echo nl2br($direct);
echo "<br /><br />";

echo $strexp[0];
echo "<br />";
echo $strexp[1];
echo "<br />";
echo $strexp[2];
echo "<br />";
echo $strexp[3];
echo "<br />";

echo $tit_cat_ser_exp[0];
echo "<br />";
echo $tit_cat_ser_exp[1];
echo "<br />";
echo $tit_cat_ser_exp[2];
echo "<br />";
echo $tit_cat_ser_exp[3];
echo "<br />";
echo $tit_cat_ser_exp[4];
echo "<br />";
?>